1. Field of the Invention
The present invention relates to a file management method and apparatus for accessing a file system formed in a storage device, such as a secondary storage device, for a computer, and inputting file information into or outputting file information from the file system.
2. Description of the Related Art
In a conventional file management system, in the case where a demand for data input/output is provided from an application section, i.e., a central processing unit (CPU) for executing an application software to, for example, a secondary storage device for forming a file system having a plurality of files, a data input/output process of the desired file of the secondary storage device is carried out as follows:
When the application section outputs data to a secondary storage device such as a disk device, an output demand from the application section is output to a buffer. Subsequently, data having a constant length of block are transferred from the application section to the buffer. When the transfer of one block data has been completed, the one block of data is transferred and stored from the buffer to the storage device.
Further, in the case where the application section outputs a next block of data, an output demand from the application section is again output to the buffer, and a like output process is carried out.
On the other hand, when the application section receives data from the storage device, a block of data is input into the buffer in response to an input demand from the application section. When the data corresponding to one block are written in the buffer, the data corresponding to the one block are input from the buffer to the application section. In the case where a next block of data are received by the application section, an input demand from the application section is provided to the buffer, and the like input process is carried out.
As described above, in the conventional file management system, in the case where the storage device into which the files are stored is, for example, a disk device, when a plurality of serial blocks which are present on a track are input/output processed, the input/output demand is executed for every block (every time) from the application section.
In addition, due to an overhead of address operation of blocks relative to the input/output demand from the application section, time for waiting for the rotation of the disk is needed. For this reason, in the conventional system, it is impossible to access the files at a high speed.
Conventionally, to cope with this problem, the block length has been elongated and the input/output demand has been executed in the enlarged block unit, to reduce the number of input/output demands and the rotation waiting times. Thus, it is possible to carry out the file access at a high speed to some extent by elongating the block length.
However, in general, the block length is determined at the time the file is produced. For this reason, in order to achieve the high speed access to the file by the enlargement of the block length, it is necessary to carry out work for transferring the original data to the file system in which the enlarged blocks are to be used. The work for transferring the data is, for example, copying, moving, restoring and the like.
When the data are to be block-processed, if a region which could not reach the block size is left in the storage device, it is impossible to effectively use the block. In the case where the block length is enlarged, the region which could not be used is left in the storage device is increased in accordance with an enlarged size of the blocks. In this case, the region which could not be effectively used is increased in the storage device. Moreover, it is necessary to provide a buffer (enlarged buffer) corresponding to the size of the block length.
After the file system has been initialized, blocks are registered in an optimum arrangement for the storage device in a management information region (which will be hereinafter referred to as "blank management information section") for managing blank blocks in the file system. For instance, in the case where a single file is created or the file is deleted, there is a high possibility that the optimum arrangement of the blocks of the blank management information section might be insured.
However, for instance, when the creation and deletion of a plurality of files have been frequently executed, the order of obtaining the blocks and the order of the release of the blocks would be unstable. For example, assuming that the condition where the blocks are in series; that is, the numbers of the blocks are serial be optimum in arrangement, as shown in FIG. 1, when the blocks are release processed, the blocks B2, B1 and B3 to be managed by the file management information section are released, and the block numbers are registered into the blank management information section without any modification irrespective of the order of the block number. For this reason, the numbers of the blocks in the blank management information section are arranged at random as shown in FIG. 1.
As shown in FIG. 2, when the blocks are picked up and processed, the blocks B2, B1 and B3 of the blank management information section are obtained in this order (without serial block number arrangement). For this reason, the numbers of the blocks of the blank management information section are arranged at random as shown in FIG. 2.
Thus, when the creation and deletion of the plurality of files have been repeated, the number of the pickup order of the blocks and the release order of the blocks are not serial and the optimum block arrangement could not be insured.